const $data = require("../data") 

 
async function  testgetDocsWithScore(){
    let params = {
        type: 'topic',
        page: 1,
        size: 20,
        from: 0,
        cid: 3,
        sort:'lastposttime',
        keywords: [ {
            name:'ohioi',
            score:0.9
        },{
            name:'southdakota',
            score:0.3
        } ]
      }
    
    let res = await $data.getDocsWithScore(params);
    console.log("res:", JSON.stringify( res));
}
// testgetDocsWithScore();

async function  getDocsBykeywords(){
    let params = {
         keywords:"Whakapapa",
         cover:1,
         limit:20,
        //  sort:'lastposttime',
         type:"topic"
         
 
    }
    let res = await $data.getDocsBykeywords(params);
    console.log(params,"res:", JSON.stringify (res.data.list));
}

//  testgetDocsWithScore();
// getDocsBykeywords();

async function  getUserNameAndPictures(){
    let params = [1]
    let res = await $data.getUserNameAndPictures(params);
    //console.log("res:", JSON.stringify (res));
}
// getUserNameAndPictures();



async function  getUser(){
     
    let res = await $data.getUser(1);
    //console.log("res:",res);
}
// getUser();
async function  updateUserName(){
     let parms ={
         username:"wenzouquan",
         password:'wen190',
         uid:1
     }
    let res = await $data.updateUserName(1,parms);
    //console.log("res:",res);
}
// updateUserName();


async function  newTopic(){
    let topic ={
        cid:1, 
        tid:86,
        title:'winn',
        mainPid:107,
        _uid:1,
        tags:['test'],
        extend:{
            upvote:9
        },
        content:"添发帖内容~，不能少于 8 个字符 test!!!"

    };
    let res = await $data.newTopic(topic);
    console.log("res:",res);
}




// newTopic();
async function  getATopic(){
     
    let res = await $data.getATopic(54);
    //console.log("res:",res);
}
// getATopic();


async function  getPosts(){
     
    let res = await $data.getPostsBySlug("58/lightning-bot-sensor");
    //console.log("res:",res);
}

// getPosts();


async function  vote(){
     
    let res = await $data.vote(58,"up",2);
    //console.log("res:",res);
}

// vote();


async function  rateSkiResort(){
    let params = {
        all_mountain_terrain: 5,
        apres_ski: 4,
        beginner: 5,
        expert: 4,
        family_friend: 5,
        intermediate: 4,
        overall_rating: 5,
        overall_value: 4,
        terrain_park: 4
    }
    let res = await $data.rateSkiResort(73,params);
    //console.log("res:",res);
}

// rateSkiResort();

async function  getTopicsByTag(){
    let res = await $data.getTopicsByTag("deer valley res");
    //console.log("res:",res);
}
// getTopicsByTag();


async function  getRegion(){
    let res = await $data.getRegion();
    //console.log("getRegion:", JSON.stringify (res));
}
// getRegion();


async function  indexTopic(){
    let res = await $data.indexTopic(74);
    //console.log("res:",res)
     
}


async function  getTopic(){
    let res = await $data.getTopic(86);
    console.log("res:",res)
     
}
// getTopic();

// indexTopic();


async function  getMeta(){  
    let res = await $data.getMeta("/test");
    //console.log("res:",res);
}

// getMeta();


async function  getPageData(){  
    let res = await $data.getPageData("/test");
    //console.log("res:",res);
}
// getPageData();


async function  updatePassword(){  
    let res = await $data.updatePassword(1,{
        "currentPassword": "wen190",
        "newPassword": "wen190"
    });
    //console.log("res:",res);
}
// updatePassword();


async function  followUser(){  
    let res = await $data.followUser(3,2);
    //console.log("res:",res);
}
// followUser();

async function  tokens(){  
    let res = await $data.tokens(1);
    //console.log("res:",res);
}
// tokens();



async function  unfollowUser(){  
    let res = await $data.unFollowUser(1,2);
    //console.log("res:",res);
}
// unfollowUser();

async function  isFollowing(){  
    let res = await $data.isFollowing(1,2);
    //console.log("res:",res);
}
// isFollowing();

async function  indexUser(){  
    let res = await $data.indexUser(1);
    //console.log("res:",res);
}
// indexUser();

async function  notiCount(){  
    let res = await $data.notiCount(1);
    //console.log("res:",res);
}
// notiCount();

async function  getUserIndexTags(){  
    let res = await $data.getUserIndexTags(1);
    console.log("res:",res);
}
// getUserIndexTags();


async function  confirmEmailByCode(){  
    let p ={
        "birthday":"1989-10-01",
        "confirm_code":"c85c7baf-5996-432d-b54c-7873f4e31535"
    }
    let res = await $data.updateAccount(1,p);
    console.log("res:",res);
}
// confirmEmailByCode();
// 重置密码
async function  resetSend(){  
    let p ={
        "resetSend":1,
        "birthday":"1989-10-01",
        "receive_email":"dragonfruit@example.org"
    }
    let res = await $data.updateAccount(1,p);
    console.log("res:",res);
}
// resetSend();


// 
async function  resetPwdByCode(){  
    let p ={
        "update_pwd_code":"bb2275ba-02d9-4003-9891-91c808753c89",
        "birthday":"1989-10-01",
        "newPassword":"wen190",
    }
    let res = await $data.updateAccount(1,p);
    console.log("res:",res);
}
// resetPwdByCode();


async function  validateEmail(){  
     
    let res = await $data.validateEmail(1,"359945126@qq.com");
    console.log("res:",res);
}

// updateAccount();

async function  createUser(){  
    let p= {
        "username": "winn  Fruit99",
        "password": "123uie",
        "email": "35994512645@qq.com",
        'SnoGoGoApikey':'09bcedd8-7ae1-42e0-a8c5-199f038b8952'
        };
    let res = await $data.createUser(p);
    console.log("res:",res);
}
// createUser();

async function  validateEmail(){  
     
    let res = await $data.validateEmail(1,"359945126@qq.com");
    console.log("res:",res);
}
// validateEmail()


async function  checkResetCode(){  
     
    let res = await $data.checkResetCode( "c50f0238-3758-415c-bb94-4c24d9713c64");
    console.log("res:",res);
}

// checkResetCode();


async function  delPost(){  
     
    let res = await $data.delPost(120,1);
    console.log("res:",res);
}

// delPost();44

async function  delTopic(){  
     
    let res = await $data.delTopic(44,1);
    console.log("res:",res);
}
// delTopic();

async function  createUserCategory(){  
     
    let res = await $data.createUserCategory(1,"测试B");
    console.log("res:",res);
}
// createUserCategory();


async function  getUserCategory(){  
     
    let res = await $data.getUserCategory(1,0,10);
    console.log("res:",res);
}

// getUserCategory();


async function  userIndexTopic(){  
     
    let res = await $data.userIndexTopic(1, 1);
    console.log("res:", JSON.stringify( res));
}
// userIndexTopic();


async function  delUserCategory(){  
     
    let res = await $data.delUserCategory(1, "测试B");
    console.log("res:", JSON.stringify( res));
}

// delUserCategory();


async function  updateUserCategory(){  
     
    let res = await $data.updateUserCategory(1, "winn","测试C");
    console.log("res:", JSON.stringify( res));
}
// updateUserCategory();


async function  userCategory(){  
let q={
    userCategoryId:"11644563879186",
    type:'topic',
    size:12,
    from:0
  }
  var res = await $data.getDocsBykeywords(q);
  console.log("res:", JSON.stringify( res));
}

// userCategory();

// console.log("aaa:",replaceAll("a","","wein a")); 
// 

async function  addTags(){
    var res = await $data.addTags(86,['adds Tags']);
    console.log("res:", JSON.stringify( res));
}
// addTags();


async function  sesData(){
    var res = await $data.sesData(":cc02bfba9123dfc62cb31d03888509bc");
    console.log("res:", JSON.stringify( res));
}

sesData();